﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WickedFlame.VecDraw.Base.Controls">

    <Style TargetType="{x:Type local:ImageTextButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Background" Value="#FFD8D8D8"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ImageTextButton}">
                    <Border 
                        Name="btnBorder"
                        Background="{TemplateBinding Background}"
                        CornerRadius="5"
                        BorderThickness="1"
                        >
                        
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                                                        
                            <Viewbox Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="16" Width="16" Margin="10">
                                <ContentPresenter x:Name="Icon"
													VerticalAlignment="Center"
													ContentSource="Icon"
                                                    HorizontalAlignment="Center"
													SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Viewbox>

                            <StackPanel Grid.Column="1" VerticalAlignment="Center">
                                <ContentControl Foreground="{TemplateBinding Foreground}" FontSize="14" VerticalAlignment="Center">
                                    <ContentPresenter ContentSource="Title" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </ContentControl>

                                <ContentControl Foreground="{TemplateBinding Foreground}"  Name="txtText" VerticalAlignment="Center">
                                        <ContentPresenter ContentSource="ButtonText" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </ContentControl>
                            </StackPanel>

                        </Grid>
                        
                    </Border>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDefault" Value="true">
                            <Setter Property="BorderBrush" Value="WhiteSmoke" TargetName="btnBorder" />
                        </Trigger>
                        
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="BorderBrush" Value="#FF565656" TargetName="btnBorder" />
                        </Trigger>
                        
                        <Trigger Property="ButtonText" Value="">
                                 <Setter Property="Visibility" Value="Hidden" TargetName="txtText" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

</ResourceDictionary>